package com.microservice.salmon.weixin.domain.qrcode;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  临时二维码请求参数
 * {"expire_seconds": 604800, "action_name": "QR_STR_SCENE", "action_info": {"scene": {"scene_str": "test"}}}
 *  永久二维码请求参数
 * {"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_str": "test"}}}
 * </p>
 *
 * @author 王洪庆 2018-12-12 17:16
 */
public class RequestQRCodeParams {
    @Setter
    @Getter
    @JsonProperty("expire_seconds")
    private Integer expireSeconds;
    @JsonProperty("action_name")
    @Setter
    @Getter
    private String actionName;

    @Getter
    @JsonProperty("action_info")
    private Map<String,Map<String,String>> actionInfo;

    public void setActionInfo(String qrContent) {
        Map<String, Map<String, String>> scene = new HashMap<>();
        Map<String, String> scene_str = new HashMap<>();
        scene_str.put("scene_str", qrContent);
        scene.put("scene",scene_str);
        this.actionInfo = scene;
    }
}
